﻿/*
 *Author: Jeff Liu 
 *
 *Under MIT License
 *jebberwocky@gmail.com
 */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CtpGglMap.Impl
{
    public class GeoPointImpl: GeoPoint, ICloneable
    {
        public static readonly GeoPoint UNDEFINED = new GeoPointImpl(-999999, -999999);

        public GeoPointImpl(double lat, double lng)
        {
            this.Lat = lat;
            this.Lng = lng;
        }

        public string Address{get;set;}

        public double Lat{get;set;}

        public double Lng{get;set;}

        public object Clone()
        {
            GeoPointImpl point = new GeoPointImpl(this.Lat, this.Lng);
            point.Address = this.Address;
            return point;
        }

        public override bool Equals(object obj)
        {
            if (this == obj)
                return true;
            else if (obj == null)
                return false;
            else if (obj.GetType() != typeof(GeoPointImpl))
                return false;
            else if (((GeoPointImpl)obj).Lat == this.Lat && ((GeoPointImpl)obj).Lng == this.Lng)
                return true;
            else
                return false;
        }

        public override int GetHashCode()
        {
            int prime = 31;
		    int result = 1;
		    double temp;
            temp = Lat;
		    result = prime * result + (int) (temp);
            temp = Lng;
		    result = prime * result + (int) (temp);
		    return result;
        }
    }
}
